//引入createApp工厂函数
import { createApp,reactive,provide } from 'vue'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from 'element-plus/es/locale/lang/zh-cn';
import App from './App.vue'
import router from '@/router'
// store
import store from './store'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

//引入 Markdown 编辑、预览组件
import VueMarkdownEditor from '@kangc/v-md-editor';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js';
import '@kangc/v-md-editor/lib/theme/style/vuepress.css';

import Prism from 'prismjs';

VueMarkdownEditor.use(vuepressTheme, {
    Prism,
});

import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/style/preview.css';
//import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
import '@kangc/v-md-editor/lib/theme/style/github.css';

// 引入高亮
import hljs from 'highlight.js';
VMdPreview.use(vuepressTheme, {
  Hljs: hljs,
});

import createKatexPlugin from '@kangc/v-md-editor/lib/plugins/katex/cdn';

VueMarkdownEditor.use(createKatexPlugin());

VMdPreview.use(createKatexPlugin())

// 引入滚动条
import PerfectScrollbar from 'vue3-perfect-scrollbar'
import 'vue3-perfect-scrollbar/dist/vue3-perfect-scrollbar.css'


const app = createApp(App)
VueMarkdownEditor.use(vuepressTheme);
app.use(ElementPlus, { locale });
app.use(ElementPlus)
app.use(router)
app.use(store)
app.use(VMdPreview)
app.use(PerfectScrollbar)
app.use(VueMarkdownEditor)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }

app.mount('#app')

